<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <?php echo $html->charset(); ?>
        <title><?php echo $this->element('pageTitle') . ' ' . $title_for_layout; ?></title>
        <?php
        echo $html->meta('icon');

        echo $html->css('default');
        echo $html->css('style');
        echo $html->css('jquery/south-street/jquery-ui-1.7.1.custom');
        echo $html->css('jquery/menu');
        echo $html->css('jquery-ui');
        // ถ้า browser ผู้ใช้ คือ IE
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
            echo $html->css('ie');
        }
        echo $javascript->link('jquery/jquery-1.3.2.min');
        echo $javascript->link('jquery/jquery-ui-1.7.1.custom.min');
        echo $javascript->link('jquery/jquery.cookie');
        echo $javascript->link('jquery/menu/mbMenu');
        echo $javascript->link('jquery/menu/jquery.metadata');
        echo $javascript->link('jquery/menu/jquery.hoverIntent');
        
        echo $scripts_for_layout;
        ?>

        <script type="text/javascript" >
            var $j = jQuery.noConflict();

            var base = "<?php echo $this->base; ?>"
            var ITS_PREFIX = "<?php echo ITS_PREFIX; ?>"
            var CUST_PREFIX = "<?php echo CUST_PREFIX; ?>"
            var SUPPLIER_PREFIX = "<?php echo SUPPLIER_PREFIX; ?>"

        </script>

        <?php
        echo $javascript->link('prototype');
        echo $javascript->link('scriptaculous/effects');    // effect ต้องมาก่อน control
        echo $javascript->link('scriptaculous/controls');

        // หน้า message ใช้ ckeditor ด้วย
        if (isset($parentNav) && $parentNav == 'messages') {
            echo $javascript->link('ckeditor/ckeditor');
            echo $javascript->link('ckeditor/config');
        }
        echo $javascript->link('myscript');
        ?>
    </head>
    <body id="body">
        <div id="container">
            <!-- Div แสดง Loading ตอนเรียกใช้ Ajax -->
            <?php echo $this->element('indicator'); ?>
            <?php echo $this->element('header'); ?>

            <div id="navigation" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
                <span id="navigator">
                    <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" >
                        <span id="user-box" >
                            <?php echo $this->element('users'); ?>
                        </span>
                        <?php echo $this->element('navigators'); ?>
                    </ul>
                    <?php //if (isset($tabMenu)) { echo $this->element($tabMenu); } ?>
                </span>
            </div>

            <div id="content" class="ui-corner-all">
                <?php
                if ($session->check('Message.flash')) { $session->flash(); }
                if  ($session->check('Message.auth'))  { $session->flash('auth'); }
                ?>
                <?php echo $content_for_layout; ?>
            </div>
            <br />
        </div>
        <?php echo $this->element('footer'); ?>
        <?php echo $cakeDebug; ?>
    </body>
</html>